package com.houtaipeingboot.controller;

import com.houtaipeingboot.pojo.Login;
import com.houtaipeingboot.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@RestController
@CrossOrigin
public class LoginController {
    @Autowired
    private LoginService ls;

    @GetMapping("/login")
    public Login login(HttpServletRequest request, HttpServletResponse response){
        String lname = request.getParameter("lname");
        String lpwd = request.getParameter("lpwd");
        Login l = new Login( lname, lpwd);
        System.out.println(l);
        Login l2 = ls.getLoginBySome(l);
        return l2;
    }

}
